import asyncio
import websockets

uri = "ws://localhost:8765"
websocket = websockets.connect(uri)

async def hello(id):
    await websocket.send(f"Hello, world! {id}")
    response = await websocket.recv()
    print(f"Received: {response}")

async def main():
    tasks = [hello(id) for id in range(2)]  # create 10 tasks
    await asyncio.gather(*tasks)

if __name__ == "__main__":
    asyncio.run(main())
    websocket.close()